
<div class="content margin_top_foot">
    <header class="header fixed_top bg_mx_green"></header>
    <div class="bg_white padding_10_15 margin_b_15 lineheight_3">订单总额：<span class="danger">￥<{$order['price']}></span></div>
    <div class="bg_white margin_b_15">
        <label class="border_b padding_10_15 v_center">
            <div class="width_70 padding_10">
                <img src="/static/images/wechatpay.jpg" alt="">
            </div>
            <div class="left_100 padding_l_15">
                <div class="font_16 lineheight_3">微信支付</div>
                <!-- <div class="">使用微信支付，安全快捷</div> -->
            </div>
            <div class="width_30 flex_center">
                <input class="radio" type="radio" value="1" checked name="paytype">
            </div>
        </label>
        <label class="border_b padding_10_15 v_center hide">
            <div class="width_70 padding_10">
                <img src="/static/images/alipay.jpg" alt="">
            </div>
            <div class="left_100 padding_l_15">
                <div class="font_16 lineheight_3">支付宝支付</div>
                <!-- <div class="">使用支付宝支付，简单安全</div> -->
            </div>
            <div class="width_30 flex_center">
                <input class="radio" type="radio" value="2" name="paytype">
            </div>
        </label>
        <label class="padding_10_15 v_center hide">
            <div class="width_70 padding_10">
                <img src="/static/images/unionpay.jpg" alt="">
            </div>
            <div class="left_100 padding_l_15">
                <div class="font_16 lineheight_3">银联支付</div>
                <!-- <div class="">使用银联支付，简单便捷</div> -->
            </div>
            <div class="width_30 flex_center">
                <input class="radio" type="radio" value="3" name="paytype">
            </div>
        </label>
    </div>
    <div class="padding_10_15">
        <button class="all_width btn_mx_green font_16 text_center lineheight_3" onclick="selectpay()">确定</button>
    </div>
</div>
<div class="toast"></div>
<!-- toast模版 -->
<script type="text/template" charset="utf-8" id='toast_template'>
    <i class="iconfont icon-toast{{=it.icon}}"></i>
    <div class="toast_text">{{=it.text}}</div>
</script>
<script type="text/javascript">
    loadheadbar("确认支付");
    var evalToast = doT.template($("#toast_template").text());
    var submited = false;
    function selectpay(e){
        if(submited) return false;
        var v = $("input[name='paytype']").val();
        if(v == 1){         //微信支付
            WeixinJSBridge.invoke(
               'getBrandWCPayRequest', <{$config}>,
               function(res){
                   if(res.err_msg == "get_brand_wcpay_request:ok" ) {
                        // 使用以上方式判断前端返回,微信团队郑重提示：
                        // res.err_msg将在用户支付成功后返回
                        // ok，但并不保证它绝对可靠。
                        window.location.href='<{$url}>';
                   }else{
                        // alert('启动微信支付失败, 请检查你的支付参数. 详细错误为: ' + res.err_msg);
                       alert('取消支付？');
                       history.go(-1);

                   }
               }
           );
        }
    }
</script>


<script type="text/javascript" charset="utf-8">
    wx.ready(function(){
        wx.hideAllNonBaseMenuItem();
    })
</script>


